import { version } from './version'

/** @type {'production' | 'development' | 'test' | 'pre'} */
type AppEnv = 'production' | 'development' | 'test' | 'pre'
const VUE_APP_ENV = process.env.VUE_APP_ENV as AppEnv || 'development'

const production = {
  api: 'https://imapi.cn',
  version,
  env: 'production',
} as const

const test = {
  api: 'https://test-api.cn',
  version,
  env: 'development',
} as const

const development = {
  api: 'https://dev-api.cn',
  version,
  env: 'development',
} as const

const pre = {
  api: 'https://pre-api.cn',
  version,
  env: 'pre',
} as const

export const serverConf = {
  production,
  development,
  test,
  pre,
}[VUE_APP_ENV]

export default serverConf
